<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>

    //
    let arr = [{ id: 2, label: "黑风大王" },
    { id: 16, label: "黑熊精" },
    { id: 32, label: "金池长老" },
    { id: 64, label: "灵虚子" },
    { id: 128, label: "幽魂" },
    { id: 256, label: "黄风大圣" },
    { id: 512, label: "小骊龙" },
    { id: 1024, label: "亢金星君" },
    { id: 2048, label: "黄眉", },
    { id: 4096, label: "百眼魔君" },
    { id: 8192, label: "猪八戒" },
    { id: 16384, label: "紫蛛儿" },
    { id: 32768, label: "白衣秀士" },
    { id: 65536, label: "百目真人" },// 原 12 变 8192 ， 0912
    ];

    function deal (arr, len = 1) {
      console.log(arr[0])
      let res = []
      function deep (temp, start) {
        if (temp.length === len) {
          res.push([...temp])
          return;
        }
        for (let index = start; index < arr.length; index++) {
          start++
          temp.push(arr[index]);

          deep(temp, start)
          temp.pop()
        }
      }
      deep([], 0);

      return res;
    }

    let res_deep = []
    function while_deep (arr, start = 1) {

      // console.log(deal(arr, start))
      while (start < arr.length) {
        res_deep.push(...deal(arr, start))
        start++;
      }
    }

    let res = while_deep(arr)
    console.log(res_deep)
    // while_deep(arr)
    // console.log(deal(arr, 2))
    // function myloop (len = 0) {


    //   if (len < arr.length) {
    //     len = len + 1;



    //     myloop(len);

    //   } else {
    //     return
    //   }
    // }
    // myloop();




    let arr1 = [{ id: 2, label: "黑风大王" },
    { id: 16, label: "黑熊精" },
    { id: 32, label: "金池长老" },
    { id: 64, label: "灵虚子" },
    { id: 128, label: "幽魂" },
    { id: 256, label: "黄风大圣" },
    ];
    let newNum = 1;

    function deepfn () {
      newNum++;
      console.log("我是递归前的值", "newNum", newNum,)
      if (newNum >= 10) {
        return
      }
      deepfn();
      newNum--
      console.log("我是递归后的值", "newNum", newNum,)

    }
    deepfn()
    // 打印结果
    // combinations.forEach(combo => console.log(combo));
    //01 02 03 04 05 12 13 14 15 23 24 25 34 35 45
    //012 013 014 015  023 024 025  034 035 045 123 124 125  134 135 145 234 235 345
    //0123 0124 0125 0134 0135 0145 0234 0235 0245 0345 1234 1235 1245 1345 2345 
  </script>
</body>

</html>